package cn.iocoder.yudao.framework.base.common.mysql.sequence;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import jakarta.annotation.Resource;

@Service
public class SeqServiceImpl implements SeqService{
    @Resource
    private SeqMapper mapper;

    public Long currVal(String seq_name) {
        return mapper.currVal(seq_name);
    }


    public Long nextVal(String seq_name) {
        return mapper.nextVal(seq_name);
    }

    @Transactional(readOnly = true)
    public int countSeq(String seq_name) {
        return mapper.countSeq(seq_name);
    }

    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
    public int insert(String seq_name) {
        return mapper.insert(seq_name);
    }



}
